package com.lee.factory;

import com.lee.Sender;
import com.lee.factory.abs.OneFactory;
import com.lee.factory.abs.Provider;
import com.lee.factory.abs.TwoFactory;
import com.lee.factory.more.MoreFactory;
import com.lee.factory.simple.SimpleFactory;

/**
 * 功能描述:
 *
 * @author liping(lpaidd50@gmail.com)
 * @version v1.0
 * @date 2017/3/24
 */
public class Main {
	public static void main(String[] args) {
		simpleFactory();
		moreFactory();
		abstractFactory();
	}

	private static void abstractFactory() {
		System.out.println();
		System.out.println("abstract");
		Provider provider = new OneFactory();
		Sender sender = provider.provider();
		sender.send();
		provider = new TwoFactory();
		sender = provider.provider();
		sender.send();
	}

	private static void moreFactory() {
		System.out.println();
		System.out.println("more");
		Sender sender = MoreFactory.createOne();
		sender.send();
		sender = MoreFactory.createTwo();
		sender.send();
	}


	public static void simpleFactory() {
		System.out.println("simple");
		Sender sender = SimpleFactory.createSender("one");
		sender.send();
		sender = SimpleFactory.createSender("two");
		sender.send();
	}
}
